﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Master/FrameMain.Master"
    AutoEventWireup="true" CodeBehind="DoForm.aspx.cs" Inherits="Jzy.Web.WorkFlow.Fore.DoForm" %>
    
<%@ Register src="Controls/Approves.ascx" tagname="Approves" tagprefix="uc2" %>
<%@ Register src="Controls/FlowStatus.ascx" tagname="FlowStatus" tagprefix="uc3" %>

<%@ Register src="Controls/Attachs.ascx" tagname="Attachs" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <asp:Literal ID="litHead" runat="server"></asp:Literal>

    <script type="text/javascript">
        function tab_click(sender, index)
        {
            var li = sender.parentNode;
            var lis = sender.parentNode.parentNode.getElementsByTagName("li");
            if (li.className != "on")
            {
                for (var i = 0; i < lis.length; i++)
                {
                    if (lis[i].className == "on")
                    {
                        lis[i].className = "";
                    }
                    document.getElementById("div" + i).style.display = "none";
                }
                li.className = "on";
                document.getElementById("div" + index).style.display = "";
            }
        }

        var fromType = '<%= (int)TaskFromType %>'; //表单是怎么传过来的，0为新建
        
        var addRight = <%=AddRight?"true":"false" %>;
       


        function selectResult(content)
        {
            var txtResult = document.getElementById('<%=txtResult.ClientID %>');
            txtResult.value += content;
        }

    </script>

    <script type="text/javascript" src="DoForm.js"></script>

    <script type="text/javascript" src="../../Common/Js/Silverlight.js"></script>

    <script type="text/javascript">
        function onSilverlightError(sender, args)
        {
            var appSource = "";
            if (sender != null & sender != 0)
            {
                appSource = sender.getHost().Source;
            }

            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;

            if (errorType == "ImageError" || errorType == "MediaError")
            {
                return;
            }

            var errMsg = "Silverlight 应用程序中未处理的错误 " + appSource + "\n";

            errMsg += "代码: " + iErrorCode + "    \n";
            errMsg += "类别: " + errorType + "       \n";
            errMsg += "消息: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError")
            {
                errMsg += "文件: " + args.xamlFile + "     \n";
                errMsg += "行: " + args.lineNumber + "     \n";
                errMsg += "位置: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError")
            {
                if (args.lineNumber != 0)
                {
                    errMsg += "行: " + args.lineNumber + "     \n";
                    errMsg += "位置: " + args.charPosition + "     \n";
                }
                errMsg += "方法名称: " + args.methodName + "     \n";
            }

            throw new Error(errMsg);
        }
    </script>

    <style type="text/css">
        div.file
        {
            width: 400px;
            margin: auto;
        }
        div.file div
        {
            height: 35px;
            line-height: 35px;
            text-align: left;
        }
        div.file div input
        {
            width: 400px;
        }
        div.file div span
        {
            font-size: 14px;
        }
        
        div#list table tr td
        {
            text-align:left; padding-left:10px;
        }
         div#list table tr td.empty
         {
             text-align:center;
         }
        div#list table tr td.title
        {
             font-weight:bold; color:Green;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript" src="../../Common/Js/Calendar.js"></script>

    <div id="toolbar_bottom">
        <input id="btnSend" runat="server" type="button" value="发送" />
        <asp:Button ID="btnSave" runat="server" Text="存草稿" OnClick="btnSave_Click" />
        <asp:Button ID="btnReturn" runat="server" Text="退回" onclick="btnReturn_Click" />
        <asp:Button ID="btnTransfer" runat="server" Text="btnTransfer" CssClass="hide" OnClick="btnTransfer_Click" />
        <asp:HiddenField ID="hidSend" runat="server" />
        <asp:HiddenField ID="hidAddSign" runat="server" />
        <asp:HiddenField ID="hidPassRound" runat="server" />
        <asp:HiddenField ID="hidNextNode" runat="server" />
    </div>
    <div id="top_daohang" class="tab" style="margin-top: 10px;">
        <ul>
            <asp:Repeater ID="rpt" runat="server" EnableViewState="true">
                <ItemTemplate>
                    <li class=''>
                        <div class="menu_l">
                        </div>
                        <div class="menu_r">
                        </div>
                        <a id='lnk_<%#Eval("ID") %>' onclick='tab_click(this,"<%#Eval("ID") %>")'>
                            <%#Eval("Name") %></a> </li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
    </div>
    <div id="divMain" style="text-align: center; overflow: auto; padding-top: 10px;">
        <!--一加height=20水平滚动条就没了-->
        <div id="div0" style="min-height: 20px;">
            <div style="margin: auto; width: 90%;">
                <asp:Literal ID="litForm" runat="server" EnableViewState="false"></asp:Literal>
                
                <div id="divResult" runat="server">
                    <table style="margin-top: 10px;" cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td style="width: 100px; font-weight: bold; color: Red; font-size: 14px; text-align: left;">
                                签署意见：
                            </td>
                            <td>
                                <asp:TextBox ID="txtResult" CssClass="txt" runat="server" Height="100px" TextMode="MultiLine"
                                    Width="100%" Style="font-size: 14px;"></asp:TextBox>
                            </td>
                            <td style="width: 300px; text-align: right;">
                                <div class="txt" style="height: 100px; margin-left: 20px; overflow: auto;">
                                    <asp:ListView ID="lv" runat="server" GroupPlaceholderID="rows" ItemPlaceholderID="cells"
                                        GroupItemCount="2">
                                        <LayoutTemplate>
                                            <table border="0">
                                                <tr id="rows" runat="server">
                                                </tr>
                                            </table>
                                        </LayoutTemplate>
                                        <GroupTemplate>
                                            <tr>
                                                <td id="cells" runat="server">
                                                </td>
                                            </tr>
                                        </GroupTemplate>
                                        <ItemTemplate>
                                            <td style="width: 50%; text-align: left;">
                                                <a href="javascript:;" onclick='selectResult("<%#Eval("Name") %>")'>
                                                    <%#Eval("Name") %></a>
                                            </td>
                                        </ItemTemplate>
                                    </asp:ListView>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div id="div1">
            <uc1:Attachs ID="Attachs1" runat="server" />            
        </div>
        <div id="div2">
            <uc2:Approves ID="Approves1" runat="server" />
        </div>
        <div id="div3" style="height:100%; overflow:hidden;">
            <uc3:FlowStatus ID="FlowStatus1" runat="server" />
        </div>
        <div style="height: 20px; line-height: 20px;">
        </div>
    </div>

    <script type="text/javascript">
        tab_click(document.getElementById("lnk_0"), 0);

        //提交后禁用一些按钮
        document.forms[0].onsubmit = function()
        {
            window.setTimeout(function()
            {
                document.getElementById('<%=btnSend.ClientID %>').disabled = true;
                document.getElementById('<%=btnSave.ClientID %>').disabled = true;
                var btnBack = document.getElementById('<%=btnReturn.ClientID %>');
                if (btnBack)
                {
                    btnBack.disabled = true;
                }
            }, 1);
        }
    </script>

</asp:Content>
